import newRequest from '@/utils/newRequest'
import request from '@/utils/request'
import { mergeParams } from '@/utils'

// 查询岗位最新列表
export function doQueryPage(query) {
  const data = mergeParams(query)
  return newRequest({
    url: '/SYS/SYstation/doQueryPage',
    method: 'post',
    // params: query
    data,
  })
}

// 添加岗位
export function doSave(query) {
  const data = mergeParams(query)
  return newRequest({
    url: '/SYS/SYstation/doSave',
    method: 'post',
    // params: query
    data,
  })
}
// 修改岗位
export function doUpdate(query) {
  const data = mergeParams(query)
  return newRequest({
    url: '/SYS/SYstation/doUpdate',
    method: 'PUT',
    // params: query
    data,
  })
}

// 删除岗位
export function doDelete(query) {
  const data = mergeParams(query)
  return newRequest({
    url: '/SYS/SYstation/doDelete',
    method: 'DELETE',
    // params: query
    data,
  })
}

// 查询岗位列表
export function listPost(query) {
  return request({
    url: '/api/v1/postlist',
    method: 'get',
    params: query
  })
}

// 查询岗位详细
export function getPost(postId) {
  return request({
    url: '/api/v1/post/' + postId,
    method: 'get'
  })
}

// 新增岗位
export function addPost(data) {
  return request({
    url: '/api/v1/post',
    method: 'post',
    data: data
  })
}

// 修改岗位
export function updatePost(data) {
  return request({
    url: '/api/v1/post',
    method: 'put',
    data: data
  })
}

// 删除岗位
export function delPost(postId) {
  return request({
    url: '/api/v1/post/' + postId,
    method: 'delete'
  })
}

